import {SET_NAME,ADD,DIS} from '../actions/homeActions'


let homeState = {
    count:0,
    name:'hanhan'
}

let TYPES = {
    [DIS](state,actions){
        -- state.count 
    },
    [ADD](state,actions){
        ++ state.count
    },
    [SET_NAME](state,actions){
        state.name = actions.value
    }
}

let home = (state = homeState,actions) =>{

    TYPES[actions.type]&&TYPES[actions.type](state,actions)

    return {...state}    
}

export default home